<%@ page language="java" contentType="text/html; charset=utf-8 " pageEncoding="utf-8" import="domain.Info,service.person.*,domain.Room" %>
<html>
	<head>
		<meta charset="utf-8">
		<base href="<%=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/" %>"/>
		<meta name="viewport" content="width=drvice-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
		<title>修改信息</title>
    </head>
    <script type="text/javascript">

                        function beforeSubmit(){
                        if(document.getElementById('name').value==''){
                        alert('姓名不能为空！');
                        document.getElementById('name').focus();
                        return false;
                        }
                        var obj2 = document.getElementsById('sex');
                        var checkcount = 0;
                        for(var x = 0;x<obj2.length;x++){
                            if(obj2[i].checked){
                                checkcount++;
                            }
                        }
                        console.log(checkcount);
                        if(!checkcount){
                        alert('未选择性别');
                        document.getElementById('sex').focus();
                        return false;
                        }
                        if(document.getElementById('phone').value==''){
                        alert('手机不能为空！');
                        document.getElementById('phone').focus();
                        return false;
                        }
                        if(document.getElementById('idcard').value==''){
                        alert('身份证号不能为空！');
                        document.getElementById('idcard').focus();
                        return false;
                        }
                        }
    </script>
	<style type="text/css">
		body{padding:0px;margin:0px;}
		.bgdiv{
			background:url(image/background.png) no-repeat;
			position: fixed;
			width: 100%;
			height: 100%;
			background-size:100% 100%;
		}
		.registeredbox{
			margin: auto;
			width: 80%;
			height: 450px;
			border-radius: 10px;
			box-shadow: rgba(0, 0, 0, 0.08) 1px 2px 4px 0px;
			background-color: white;
			opacity: 0.6;
			text-align: center;
			overflow:auto;
		}
		.title{
			padding-top: 20px;
			font-weight: 600;
		}
		button{
			border-width: 0px;
			    width: 70px;
			    height: 25px;
			    background: inherit;
			    background-color: rgba(0, 207, 226, 1);
			    border: none;
			    border-radius: 50px;
			    -moz-box-shadow: none;
			    -webkit-box-shadow: none;
			    box-shadow: none;
			    font-size: 14px;
			    color: #FFFFFF;
				margin-top: 5px;
		}
		input{
						width: 100%;
						height: 6px;
		                border: 1px solid #ccc;
		                padding: 7px 0px;
		                border-radius: 3px;
		                padding-left:5px;
		                -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
		                box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
		                -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
		                -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
		                transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s
		            }
		            input:focus{
		                    border-color: #66afe9;
		                    outline: 0;
		                    -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
		                    box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)
		            }
					.loginform{
						margin: auto;
						width: 80%;
						padding-top: 20px;
						text-align: left;
						font-size: 12px;
						font-weight: 700;
					}
	</style>
		<%
                            	Room room=new Room();
                            	if(session.getAttribute("userloginflag")==null){
                            	%>
                            	<script type="text/javascript">
                            	    window.location.href="index.jsp";
                            	</script>
                                <% }else{
                                room=(Room)session.getAttribute("userloginflag");
                                %>
	<body>
		<div class="bgdiv"></div>
			<div class="registeredbox">
				<div class="title">修改信息</div>
				<div class="loginform">
				<%          int i = Integer.parseInt(request.getParameter("info_id"));
				            PersonService personService = new PersonServiceImpl();
				            Info info = personService.getInfoById(i);
				%>
				<form action="UpdatePerson?info_id=<%=info.getInfo_id() %>" method="post"  enctype="multipart/form-data"  onsubmit="return beforeSubmit(this)" name="updateform">

                    姓名<font style="color: red;">*</font><span id="info"></span><br />
					<input type="text" name="name" id="name" readonly="readonly" value="<%=info.getName() %>" /><br />
					<span style="font-size: 8px;font-weight: 200;color: #555555;">常驻人员姓名</span><br /><br />

					手机<font style="color: red;">*</font>
					<input type="text" name="phone" id="phone"  value="<%=info.getPhone() %>" /><br />
					<span style="font-size: 8px;font-weight: 200;color: #555555;">常驻人员的有效联系方式</span><br /><br />

					车牌<font style="color: red;"></font>
					<input type="text" name="carid" id="carid" value="<%=info.getCarid() %>"  /><br />
					<span style="font-size: 8px;font-weight: 200;color: #555555;">常驻人员车牌，可不填</span><br /><br />

					身份证号<font style="color: red;">*</font><br />
					<input type="text" name="idcard" id="idcard" value="<%=info.getIdcard() %>" /><br />
					<span style="font-size: 8px;font-weight: 200;color: #555555;">常驻人员的身份证号</span><br /><br />

					身份证照片<font style="color: red;"></font><br />
					<span style="font-size: 8px;font-weight: 200;color: #555555;">应提供个人身份证正反面照片，若无身份证请上传户口本户主页与该成员页照片</span><br />
					&nbsp;正面(或户口本户主页)
					<input type="file" id="identity_img1" name="identity_img1" onchange='PreviewImage1(this)' style="height:30px ;"  /><br />
					<div id="imgPreview1" style="position: relative;left: 8%;margin-top: 10px;"><img src="<%=info.getIdentity_img1() %>" width="100px"  /></div><br /><br />

					&nbsp;反面(或户口本本人页)
					<input type="file" id="identity_img2" name="identity_img2" onchange='PreviewImage2(this)' style="height:30px ;"  /><br />
					<div id="imgPreview2" style="position: relative;left: 8%;margin-top: 10px;"><img src="<%=info.getIdentity_img2() %>" width="100px"  /></div><br /><br />

					个人免冠照<font style="color: red;"></font><br />
					<span style="font-size: 8px;font-weight: 200;color: #555555;">必须为本人近期正面免冠彩色头像，头部长度占照片长度的2/3，不着制式服装或白色上衣，常带眼镜的应佩戴眼镜</span><br />
					<input type="file" id="photo_img" name="photo_img" onchange='PreviewImage3(this)' style="height:30px ;"  /><br />
					<div id="imgPreview3" style="position: relative;left: 8%;margin-top: 10px;"><img src="<%=info.getPhoto_img() %>" width="60px"  /></div><br />
					<br />

					<center><button type="submit" id="submit">修改</button></center>
				</form>
				</div>
			</div>

	</body><% } %>
	<script>
	    if(/Android (\d+\.\d+)/.test(navigator.userAgent)){
	       var version = parseFloat(RegExp.$1);
	    if(version>2.3){
	       var phoneScale = parseInt(window.screen.width)/230;
	       document.write('<meta name="viewport" content="width=230, minimum-scale = '+ phoneScale +', maximum-scale = '+ phoneScale +', user-scalable=no, target-densitydpi=device-dpi">');
	       }else{
	            document.write('<meta name="viewport" content="width=230, target-densitydpi=device-dpi">');
	       }
	       }else{
	            document.write('<meta name="viewport" content="width=230, user-scalable=no, target-densitydpi=device-dpi">');
	       }
			   function PreviewImage1(imgFile)
    			{
    				var pattern = /(\.*.jpg$)|(\.*.png$)|(\.*.jpeg$)|(\.*.gif$)|(\.*.bmp$)/;
    				if(!pattern.test(imgFile.value))
    				{
    					alert("系统仅支持jpg/jpeg/png/gif/bmp格式的照片！");
    					imgFile.focus();
    				}
    				else
    				{
    					var path;
    					if(document.all)//IE
    					{
    						imgFile.select();
    						path = document.selection.createRange().text;
    						document.getElementById("imgPreview1").innerHTML="";
    						document.getElementById("imgPreview1").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src=\"" + path + "\")";//使用滤镜效果
    					}
    					else//FF
    					{
    						path = URL.createObjectURL(imgFile.files[0]);
    						document.getElementById("imgPreview1").innerHTML = "<img src='"+path+"' width='100px'/>";
    					}
    				}
    			}
    			function PreviewImage2(imgFile)
    						{
    							var pattern = /(\.*.jpg$)|(\.*.png$)|(\.*.jpeg$)|(\.*.gif$)|(\.*.bmp$)/;
    							if(!pattern.test(imgFile.value))
    							{
    								alert("系统仅支持jpg/jpeg/png/gif/bmp格式的照片！");
    								imgFile.focus();
    							}
    							else
    							{
    								var path;
    								if(document.all)//IE
    								{
    									imgFile.select();
    									path = document.selection.createRange().text;
    									document.getElementById("imgPreview2").innerHTML="";
    									document.getElementById("imgPreview2").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src=\"" + path + "\")";//使用滤镜效果
    								}
    								else//FF
    								{
    									path = URL.createObjectURL(imgFile.files[0]);
    									document.getElementById("imgPreview2").innerHTML = "<img src='"+path+"' width='100px'/>";
    								}
    							}
    						}
    		function PreviewImage3(imgFile)
    					{
    						var pattern = /(\.*.jpg$)|(\.*.png$)|(\.*.jpeg$)|(\.*.gif$)|(\.*.bmp$)/;
    						if(!pattern.test(imgFile.value))
    						{
    							alert("系统仅支持jpg/jpeg/png/gif/bmp格式的照片！");
    							imgFile.focus();
    						}
    						else
    						{
    							var path;
    							if(document.all)//IE
    							{
    								imgFile.select();
    								path = document.selection.createRange().text;
    								document.getElementById("imgPreview3").innerHTML="";
    								document.getElementById("imgPreview3").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src=\"" + path + "\")";//使用滤镜效果
    							}
    							else//FF
    							{
    								path = URL.createObjectURL(imgFile.files[0]);
    								document.getElementById("imgPreview3").innerHTML = "<img src='"+path+"' width='60px'/>";
    							}
    						}
    					}
	</script>
</html>